////////////////////////////////////////////////////////////
//	File	:	"CEngineState.h"
//
//	Author	:	Christian Sassi	(CS)
//
//	Purpose	:	To execute the main menu.
////////////////////////////////////////////////////////////
#include "CEngineState.h"

#include "IDXRenderable.h"
#include "CDXShaderManager.h"
#include "CDXMeshManager.h"
#include "CDXRenderWin32.h"

CEngineState::CEngineState(void)
{
	
}

CEngineState::~CEngineState(void)
{

}


void CEngineState::Enter(void)
{

	//Rendering should be initialized within CGame.
	//CDXRenderWin32::GetInstance()->Init();


	//TODO Initializing should REALLY be done inside of the CDXRenderWin32
	CDXShaderManader::GetInstance()->Init();
	CDXShaderManader::GetInstance()->LoadShadersFromDirectory();
	int nShaderIndex = -2;
	//////////////////////////////////////////////////////////////////////////
	//Yea, this wont work yet...theres uniforms and shit...
	//////////////////////////////////////////////////////////////////////////
	nShaderIndex = CDXShaderManader::GetInstance()->GetShaderIndex("PixelMotionBlur.fx");
	
	// HACK testing IDXRenderable
	IDXRenderable* obj = new IDXRenderable(CDXMeshManager::GetInstance()->LoadNewDirectXMesh("bigship1.x"), IDXRenderable::DX_3DOBJECT);
	obj->SetShaderID(nShaderIndex);
	obj->SetIsShaderApplied(false);
	m_drawList.push_back(obj);
	
}

void CEngineState::Exit(void)
{
	//Shutdown in reverse order
	unsigned size = (unsigned)m_drawList.size();
	for (unsigned int i = 0; i < size; ++i)
	{
		delete m_drawList[i];
	}
}

bool CEngineState::Input(void)
{
	return true;
}

void CEngineState::Update(float fElapsedTime)
{
	
}

void CEngineState::Render(void)
{
	
	CDXRenderWin32::GetInstance()->Render(&m_drawList);
}


//EOF